from wtforms import Form, StringField, IntegerField
from wtforms.validators import DataRequired, length, Regexp


class SearchForm(Form):
    q = StringField(validators=[DataRequired(), length(min=1, max=13)])
    page = IntegerField(default=1)


class DriftForm(Form):
    recipient_name = StringField(validators=[DataRequired(), length(min=2, max=20, message='收件人姓名规范')])
    mobile = StringField(validators=[DataRequired(), Regexp('^1[0-9]{10}$', 0, '请输入正确的手机号')])
    message = StringField()
    address = StringField(validators=[DataRequired(), length(min=10, max=70, message='地址规范')])
